// DrawEdit.cpp : implementation file
//

#include "stdafx.h"
#include "DrawEdit.h"


// CDrawEdit

IMPLEMENT_DYNAMIC(CDrawEdit, CEdit)

CDrawEdit::CDrawEdit()
{

}

CDrawEdit::~CDrawEdit()
{
}


BEGIN_MESSAGE_MAP(CDrawEdit, CEdit)
	ON_WM_NCPAINT()
	ON_WM_PAINT()
	ON_WM_ERASEBKGND()
END_MESSAGE_MAP()



// CDrawEdit message handlers

void CDrawEdit::OnNcPaint()
{
	// TODO: Add your message handler code here
	// Do not call CEdit::OnNcPaint() for painting messages

	CRect rc;
	GetWindowRect(&rc);
	CRect rcWindow(0,0,rc.Width(),rc.Height());

	CBrush brushFrame;
	brushFrame.CreateSolidBrush(RGB(255,0,0));

	CWindowDC dc(this);
	//dc.FrameRect(&rcWindow,&brushFrame);
	dc.FillRect(&rcWindow,&brushFrame);

	CString strText;
	this->GetWindowText(strText);
	//this->SetWindowText(strText);
	dc.TextOut( 2, 1, strText );
}


void CDrawEdit::OnPaint()
{
	CPaintDC dc(this); // device context for painting
	// TODO: Add your message handler code here
	// Do not call CEdit::OnPaint() for painting messages

	//CRect rc;
	//GetClientRect(&rc);
	//CRect rcWindow(0,0,rc.Width(),rc.Height());

	//CBrush brushFrame;
	//brushFrame.CreateSolidBrush(RGB(0,120,255));

	////dc.FrameRect(&rcWindow,&brushFrame);
	//dc.FillRect(&rcWindow,&brushFrame);
	//

	////CString strText;
	////this->GetWindowText(strText);
	////this->SetWindowText(strText);

	////HDC MemDC;
	////CBitmap bit;
	////MemDC =CreateCompatibleDC(0);
	////CString cc;
	////bit.LoadBitmap(IDB_BITMAP_TREELEFTBK);
	////SelectObject(MemDC,bit);
	////CRect rc;
	////GetClientRect(rc);
	//////BitBlt(dc.m_hDC,0,0,rc.Width(),rc.Height(),MemDC,0,0,SRCCOPY);
	////TransparentBlt(dc.m_hDC, 0, 0, rc.Width(),rc.Height(), MemDC, 0, 0, 1024, 768, RGB(0,0,0xff));

}


BOOL CDrawEdit::OnEraseBkgnd(CDC* pDC)
{
	// TODO: Add your message handler code here and/or call default

	//return TRUE;
	return CEdit::OnEraseBkgnd(pDC);
}
